package com.chinasoft.movies.controller;

import com.chinasoft.movies.pojo.CountByYear;
import com.chinasoft.movies.service.CountByYearService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Log4j2
@CrossOrigin
public class CountByYearController {

    @Autowired
    CountByYearService countByYearService;

    //每年上映的电影数（返回：year(Long), movieCount(Long) )
    @GetMapping("/queryMovieCountByYear")
    public List<CountByYear> queryCountByYear(){
        List<CountByYear> result = countByYearService.queryCountByYear();
        return result;
    }
}
